package com.loongxun.playwithyou.ui.activity.sparring;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.loongxun.playwithyou.R;

/**
 * 成为陪练-选择男女
 * Created by Administrator on 2017/8/29.
 */
public class SparringActivity extends Activity implements View.OnClickListener{

    //标题
    private TextView tv_top_title;
    //妹子，大神
    private LinearLayout ll_sp_nv,ll_sp_nan;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_sparring);

        initView();
        changeTab(0);
    }

    private void initView() {
        tv_top_title = (TextView) findViewById(R.id.tv_top_title);
        tv_top_title.setText("成为陪练");
        findViewById(R.id.iv_back).setOnClickListener(this);

        ll_sp_nv = (LinearLayout) findViewById(R.id.ll_sp_nv);
        ll_sp_nan = (LinearLayout) findViewById(R.id.ll_sp_nan);
        ll_sp_nv.setOnClickListener(this);
        ll_sp_nan.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.ll_sp_nv:
                changeTab(0);
                ll_sp_nv.setBackgroundResource(R.drawable.corners_bg_5_red);
                ll_sp_nan.setBackgroundResource(R.drawable.corners_line_5_1_48);
                break;
            case R.id.ll_sp_nan:
                changeTab(1);
                ll_sp_nv.setBackgroundResource(R.drawable.corners_line_5_1_48);
                ll_sp_nan.setBackgroundResource(R.drawable.corners_bg_5_red);
                break;
            default:
                break;
        }
    }

    private void changeTab(int index){
        ll_sp_nv.setSelected(index == 0);
        ll_sp_nan.setSelected(index == 1);
    }


}
